const SensorModel = require('../models/sensor');

class SensorController {
  static async getSensorData(req, res) {
    try {
      const data = await SensorModel.getSensorData();
      res.json(data);
    } catch (error) {
      console.error('Error in getSensorData:', error);
      res.status(500).json({ error: 'Internal server error' });
    }
  }

  static async getHistoryData(req, res) {
    try {
      const data = await SensorModel.getHistoryData();
      res.json(data);
    } catch (error) {
      console.error('Error in getHistoryData:', error);
      res.status(500).json({ error: 'Internal server error' });
    }
  }
}

module.exports = SensorController; 